﻿/// <reference path="../GeneratedArtifacts/viewModel.js" />

myapp.ViewCar.Details_postRender = function (element, contentItem) {
    contentItem.dataBind("screen.Car.Id", function (newValue) {
        contentItem.screen.details.displayName = "Car (" + (newValue == null ? "New" : newValue) + ")";
    });
};

myapp.ViewCar.DeepLink_postRender = function (element, contentItem) {
    // The hash is present on non-home screens.  Since we're
    // doing this on the home screen we could skip this part
    // but here it is for completeness.
    var hashPos = window.location.href.indexOf("#");
    if (hashPos >= 0)
        var baseUrl = window.location.href.substr(0, hashPos);
    else
        var baseUrl = window.location.href;
    var fullUrl = baseUrl + "?entity=MMC_Content/Cars(" +
                  contentItem.screen.Car.Id + ")";
    contentItem.screen.CarUrl = fullUrl;
};

